#include <bits/stdc++.h>
using namespace std;
int n;
const int N = 1e5 + 10;
int a[N], b[N];

int main() {
	cin >> n;
	while (n--) {
		int s = 0, x;
		cin >> x;
		for (int i = x; i; i -= i & -i) {
			s++;
		}
		cout << s << ' ';
	}

	return 0;
}